package com.teaphy.coroutinecrawler.flow.operators


import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*

fun main() = runBlocking{
    flow {
        emit(1)
        delay(50)
        emit(2)
    }.collectLatest { value ->
        println("Collecting $value")
        delay(100) // Emulate work
        println("$value collected")
    }

    println("Done")
}